#ifndef SERVER_H
#define SERVER_H

#include <QtCore>
#include <QtNetwork>

struct ServerInfo
{
  ServerInfo();
  ServerInfo(const ServerInfo &info);

  QString host, user, pass, dir, proxyHost;
  int port, proxyPort;
};

//class Server : public QObject
//{
//  Q_OBJECT
//public:
//    Server(QObject *parent = 0);
//
//    void setInfo(const ServerInfo &info);
//
//    bool connectFtp();
//    inline bool connected() const { return myFtp->state() == QFtp::LoggedIn; }
//
//    int getFile(const QString &serverPath, const QString &localPath, const QString &name);
//
//signals:
//    void stateChanged(int);
//
//protected slots:
//    void commandFinished(int,bool);
//
//protected:
//    ServerInfo myInfo;
//    QFtp *myFtp;
//    int myConnId;
//    bool myCommandFinished, myCommandError;
//};

class Server : public QObject
{
  Q_OBJECT
public:
    Server(QObject *parent = 0);

    void setInfo(const ServerInfo &info);

    bool connectServer();
    inline bool connected() const { return true; }

    int getFile(const QString &serverPath, const QString &localPath, const QString &name);

signals:
    void stateChanged(int);

protected slots:
    //void commandFinished(int,bool);
	void done(bool err);

protected:
    ServerInfo myInfo;
    QHttp *myHttp;
    int myConnId;
    bool myCommandFinished, myCommandError;
};

#endif // SERVER_H
